From: Owen W. Taylor Date: Sat, 26 Mar 2011 20:36:27 +0000 (-0400) Subject: boxPointer: use shell_util_get_transformed_allocation() X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~8433 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=bc48bd5f4a62ba7f2a655264ee6200f0f23e45c4;p=gnome-shell.git boxPointer: use shell_util_get_transformed_allocation() Using ClutterActor.get_transformed_size() can produce bugs if we happen to position the box pointer when the source actor has a relayout queued. Use our newly added reliable utility function instead. https://bugzilla.gnome.org/show_bug.cgi?id=645744 --- diff --git a/js/ui/boxpointer.js b/js/ui/boxpointer.js index 619e0c552..5df1f254f 100644 --- a/js/ui/boxpointer.js +++ b/js/ui/boxpointer.js @@ -330,10 +330,9 @@ BoxPointer.prototype = { // Position correctly relative to the sourceActor let sourceNode = sourceActor.get_theme_node(); let sourceContentBox = sourceNode.get_content_box(sourceActor.get_allocation_box()); - let [sourceX, sourceY] = sourceActor.get_transformed_position(); - let [sourceWidth, sourceHeight] = sourceActor.get_transformed_size(); - let sourceCenterX = sourceX + sourceContentBox.x1 + (sourceContentBox.x2 - sourceContentBox.x1) / 2; - let sourceCenterY = sourceY + sourceContentBox.y1 + (sourceContentBox.y2 - sourceContentBox.y1) / 2; + let sourceAllocation = Shell.util_get_transformed_allocation(sourceActor); + let sourceCenterX = sourceAllocation.x1 + sourceContentBox.x1 + (sourceContentBox.x2 - sourceContentBox.x1) / 2; + let sourceCenterY = sourceAllocation.y1 + sourceContentBox.y1 + (sourceContentBox.y2 - sourceContentBox.y1) / 2; let [minWidth, minHeight, natWidth, natHeight] = this.actor.get_preferred_size(); // We also want to keep it onscreen, and separated from the @@ -351,16 +350,16 @@ BoxPointer.prototype = { switch (this._arrowSide) { case St.Side.TOP: - resY = sourceY + sourceHeight + gap; + resY = sourceAllocation.y2 + gap; break; case St.Side.BOTTOM: - resY = sourceY - natHeight - gap; + resY = sourceAllocation.y1 - natHeight - gap; break; case St.Side.LEFT: - resX = sourceX + sourceWidth + gap; + resX = sourceAllocation.x2 + gap; break; case St.Side.RIGHT: - resX = sourceX - natWidth - gap; + resX = sourceAllocation.x1 - natWidth - gap; break; }